﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Psn0a01
    {
		private string _comcode;
		private string _item;
		private string _itemtext;
		private string _valuename;
		private string _value1;
		private string _value2;
		
        /// <summary>
        /// 公司标识
        /// </summary>
		public string Comcode
		{
			get { return _comcode;	 }
			set { _comcode=value;	}
		}
        /// <summary>
        /// 项
        /// </summary>
		public string Item
		{
			get { return _item;	 }
			set { _item=value;	}
		}
        /// <summary>
        /// 项名称
        /// </summary>
		public string Itemtext
		{
			get { return _itemtext;	 }
			set { _itemtext=value;	}
		}
        /// <summary>
        /// 值
        /// </summary>
		public string Valuename
		{
			get { return _valuename;	 }
			set { _valuename=value;	}
		}
        /// <summary>
        /// 值2
        /// </summary>
		public string Value1
		{
			get { return _value1;	 }
			set { _value1=value;	}
		}
        /// <summary>
        /// 值3
        /// </summary>
		public string Value2
		{
			get { return _value2;	 }
			set { _value2=value;	}
		}
		
		public static List<Psn0a01> GetPsn0a01ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Psn0a01> list = new List<Psn0a01>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Psn0a01 model = GetPsn0a01ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Psn0a01 GetPsn0a01ByDataRow(DataRow dr)
		{
			Psn0a01 model = new Psn0a01(); //实例化Psn0a01
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("comcode")&&!(dr["comcode"] is System.DBNull))  
				model.Comcode = ( string)dr["comcode"];
			if (dcc.Contains("item")&&!(dr["item"] is System.DBNull))  
				model.Item = ( string)dr["item"];
			if (dcc.Contains("itemtext")&&!(dr["itemtext"] is System.DBNull))  
				model.Itemtext = ( string)dr["itemtext"];
			if (dcc.Contains("valuename")&&!(dr["valuename"] is System.DBNull))  
				model.Valuename = ( string)dr["valuename"];
			if (dcc.Contains("value1")&&!(dr["value1"] is System.DBNull))  
				model.Value1 = ( string)dr["value1"];
			if (dcc.Contains("value2")&&!(dr["value2"] is System.DBNull))  
				model.Value2 = ( string)dr["value2"];
			
			return model;
		}
    }
}
